/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package GUI.EditorMenu;

import General.CurrentData;
import java.awt.Desktop;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.IOException;
import javax.swing.*;

/**
 *
 * @author David
 */
public class ImportMenu extends JMenu
{

    private JMenuItem modelItem = new JMenuItem("Model");
    private JMenuItem soundItem = new JMenuItem("Sound");
    private JMenuItem textureItem = new JMenuItem("Texture");
    private JMenuItem otherItem = new JMenuItem("Other");
    private JMenuItem openFolderItem = new JMenuItem("Open Asset Folder");

    /**
     *
     */
    public ImportMenu()
    {
        setEnabled(false);
        setText("Import");
        add(modelItem);
        add(soundItem);
        add(textureItem);
        add(otherItem);
        add(new JSeparator());
        add(openFolderItem);
        initActions();
    }

    private void initActions()
    {
        openFolderItem.addActionListener(new ActionListener()
        {
            public void actionPerformed(ActionEvent e)
            {
                try
                {
                    Desktop.getDesktop().open(CurrentData.getProject().getAssetsFolder());
                } catch (IOException ex)
                {
                    CurrentData.getObserverDialog().printError("Error opening Asset-Folder in File Manager", ex);
                }
            }
        });
    }
}
